#include "EZRPC_Signal.h"


void EZRPC_Signal::signal()
{
	std::lock_guard<std::mutex> lck(m_mutex);
	nty_ = true;
	m_cond.notify_all();
}

bool EZRPC_Signal::wait_for(int intr /*= 5000*/)
{
	std::unique_lock<std::mutex> lck(m_mutex);
	auto ret = m_cond.wait_for(lck, std::chrono::milliseconds(intr),[this](){
		return nty_;
	});
	nty_ = false;
	return ret;
}

void EZRPC_Signal::wait()
{
	std::unique_lock<std::mutex> lck(m_mutex);
	m_cond.wait(lck,[this](){
		return nty_;
	});
	nty_ = false;
}
